<?php
/**
 * 项目入口文件
 * Created by PhpStorm.
 * User: mohuani
 * Date: 2019/4/13
 * Time: 16:09
 */

ini_set('display_errors','on');
ini_set('error_reporting',E_ALL);

require_once "global.php";
require_once "autoload.php";

use App\Utils\Util;

$con = isset($_REQUEST['con']) ? $_REQUEST['con'] : '';
$act = isset($_REQUEST['act']) ? $_REQUEST['act'] : '';

$util = new Util();

switch ($con)
{
    case 'WeatherInfoByCityName':
        $con = new App\Controllers\WeatherInfoByCityNameController();
        break;
    case 'WeatherInfoByCityKey':
        $con = new App\Controllers\WeatherInfoByCityKeyController();
        break;
    default:
        $res = [
            'status_code' => '',
            'status_msg' => 'con不能为空',
            'data' => [],
        ];
        $util->JsonReturn($res);
        break;
}

if (!method_exists($con, $act)) {
    $res = [
        'status_code' => '',
        'status_msg' => 'act不能为空',
        'data' => [],
    ];
    $util->JsonReturn($res);
} else {
    $con->$act();
}





